<template>
  <div class="record">
    <el-table
      :header-cell-style="{ }"
      :data="pageResult"

      v-loading="loading"
      style="width: 100%"
      element-loading-text="加载中..."
      row-class-name=""
      cell-class-name=""


    >
    
      <el-table-column
        prop="Person"
        label="是否有人"
        align="center"
      >
        <template slot-scope="scope">
            <span>{{scope.row.Person===1 ? '有人':'无人' }}</span>
        </template>
      </el-table-column>
      <el-table-column
        prop="Person"
        label="声音"
        align="center"
      >
        <template slot-scope="scope">
            <span>{{scope.row.Voice===1 ? '有声':'无声' }}</span>
        </template>
      </el-table-column>
       <el-table-column
        prop="Heart_rate"
        label="心率"
        align="center"
      >
      </el-table-column>
      <el-table-column
        prop="Breath_rate"
        label="呼吸率"
        align="center"
      >
      </el-table-column>
      <el-table-column
        prop="Sound_db"
        label="环境声音"
        align="center"
      >
      </el-table-column>
       <el-table-column
        prop="Noise_db"
        label="噪音"
        align="center"
      >
      </el-table-column>
       <el-table-column
        prop="Time"
        label="检测时间"
        align="center"
      >
      <template slot-scope="scope">
          {{$format(scope.row.Time)}}
      </template>
      </el-table-column>
    </el-table>
    <el-pagination
      layout="total, prev, pager, next, jumper"
      @current-change="refreshPageRequest"
      :current-page="pageRequest.page"
      :page-size="pageRequest.limit"
      :total="totalSize"
      style="float: right"
    ></el-pagination>
  </div>
</template>
<script>
export default {
  props:{
     GSM_IMEI:String
    },
  data() {
    return {
      pageResult: [],
      loading: true,
      totalSize:0,
      pageRequest:{
          page:1,limit:10
      }
    };
  },
  async mounted() {
      await this.getList(this.GSM_IMEI);
  },
  methods: {
    refreshPageRequest(e) {
        this.loading = true;
        this.pageRequest.page = e;
        this.getList(this.GSM_IMEI);
    },
     // 异常数据
  getList(GSM_IMEI){
    let that = this;
    var param = {
      GSM_IMEI,
      limit:this.pageRequest.limit || 10,
      page:this.pageRequest.page
    }
     return new Promise(
       resolve=>{
        that.$api.wxNotic.gsm_getData_history(param).then(
          res=>{
            if(res.code===0){
              that.pageResult=res.data;
              that.totalSize = res.count;
            }
            that.loading = false;
            resolve(res.data)
          })
       }
     )
  },
  },
};
</script>

<style>
/* 每行的样式 */
.record .el-table--striped .el-table__body tr.el-table__row--striped td{
    background-color: #2BB5FB;
}
/* 选中行样式 */
.record .el-table--enable-row-hover .el-table__body tr:hover>td {
  background-color: #c7cace;
  color: #fff;
}
</style>
